/**
 * Project Name:FileServiceAPI
 * File Name:FileServiceAPI.java
 * Package Name:com.bwda.dsrs.businessservice.api;
 * Date:2019年4月28日
 * Copyright (c) 2019, 江苏保旺达软件有限公司 All Rights Reserved.
 */
package com.bwda.dsrs.filecenter.api;

import com.bwda.dsrs.base.centerbase.response.CentreCutPageResponse;
import com.bwda.dsrs.base.centerbase.response.CentreListResponse;
import com.bwda.dsrs.base.centerbase.response.ResponseEntity;
import com.bwda.dsrs.filecenter.api.clientappversion.datadict.DatadictCreateForm;
import com.bwda.dsrs.filecenter.api.clientappversion.datadict.DatadictQueryForm;
import com.bwda.dsrs.filecenter.api.clientappversion.datadict.DatadictVo;
import com.bwda.dsrs.filecenter.api.clientappversion.group.GroupQueryForm;
import com.bwda.dsrs.filecenter.api.clientappversion.group.GroupVo;
import com.bwda.dsrs.filecenter.api.clientappversion.org.*;
import com.bwda.dsrs.filecenter.api.clientappversion.user.UserForm;
import com.bwda.dsrs.filecenter.api.clientappversion.user.UserPo;
import com.bwda.dsrs.filecenter.api.clientappversion.user.UserQueryForm;
import com.bwda.dsrs.filecenter.api.clientappversion.user.UserVo;
import com.bwda.dsrs.filecenter.config.FeginInterceptor;
import com.bwda.dsrs.filecenter.domain.api.DatadictUpdateForm;
import com.bwda.dsrs.filecenter.domain.exception.BusinessServiceException;
import com.bwda.dsrs.filecenter.domain.form.filespacesetting.FileSpaceSettingQueryForm;
import com.bwda.dsrs.systemservice.domain.po.datadict.DatadictPo;
import com.bwda.dsrs.systemservice.domain.po.userlevel.UserLevelPo;
import com.bwda.dsrs.systemservice.domain.vo.emailsettting.EmailSetttingVo;
import com.bwda.dsrs.systemservice.domain.vo.msgtemplate.MsgTemplateVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


/**
 * 组织访问接口
 *
 * @author youzhen
 * @date 2019 /4/19
 */
@FeignClient(name = "systemservice", fallback = OrgFallback.class, configuration = FeginInterceptor.class)
public interface OrgServiceApi {

    /**
     * 根据用户获得组织信息
     *
     * @param userCode user code
     * @return org form
     */
    @RequestMapping(value = "/s/org/queryOrg", method = RequestMethod.POST)
    OrgForm queryOrg(@RequestParam(value = "userCode") String userCode);

    /**
     * 根据ID获得组织信息
     *
     * @param id id
     * @return org form
     */
    @RequestMapping(value = "/s/org/queryByIdOrg", method = RequestMethod.POST)
    OrgForm queryByIdOrg(@RequestParam(value = "id") long id);

    /**
     * 查询人员组织树
     *
     * @return list list
     */
    @RequestMapping(value = "/s/org/queryOrgUserTree", method = RequestMethod.POST)
    List<OrgUserTreeForm> queryOrgUserTree();

    /**
     * 查询组织树
     *
     * @return list list
     */
    @RequestMapping(value = "/s/org/queryOrgTree", method = RequestMethod.POST)
    List<OrgTreeForm> queryOrgTree();

    /**
     * 根据组织ID获取管理员
     *
     * @param id id
     * @return list list
     */
    @RequestMapping(value = "/s/org/queryOrgAdmin", method = RequestMethod.POST)
    List<OrgUserAdminForm> queryOrgAdmin(@RequestParam(value = "id") long id);

    /**
     * 根据组织ID获取组织下的人
     *
     * @param form form
     * @return response entity
     */
    @RequestMapping(value = "/s/user/queryPageList", method = RequestMethod.POST)
    ResponseEntity<CentreCutPageResponse<UserPo>> queryPageList(@RequestBody UserQueryForm form);

    /**
     * 根据组织ID获取组织下的人
     *
     * @param form form
     * @return response entity
     */
    @RequestMapping(value = "/s/user/queryUserPageList", method = RequestMethod.POST)
    ResponseEntity<CentreCutPageResponse<UserPo>> queryUserPageList(@RequestBody UserQueryForm form);

    /**
     * 获取工作组
     *
     * @param groupQueryForm group query form
     * @return response entity
     */
    @RequestMapping(value = "/s/group/queryGroupPageList", method = RequestMethod.POST)
    ResponseEntity<CentreCutPageResponse<GroupVo>> queryGroupPageList(@RequestBody GroupQueryForm groupQueryForm);

    /**
     * Query group list response entity
     *
     * @param form form
     * @return the response entity
     */
    @RequestMapping(value = "/s/group/queryListRequestBody", method = RequestMethod.POST)
    ResponseEntity<CentreListResponse<GroupVo>> queryGroupList(@RequestBody GroupQueryForm form);

    /**
     * 修改
     *
     * @param form form
     * @return response entity
     */
    @RequestMapping(value = "/s/datadict/updateWithRequestBody", method = RequestMethod.POST)
    ResponseEntity updateDatadict(@RequestBody DatadictUpdateForm form);

    /**
     * 字典列表查询（简约）
     *
     * @param form form
     * @return response entity
     */
    @RequestMapping(value = "/s/datadict/queryList")
    public ResponseEntity<CentreListResponse<DatadictVo>> queryDatadictList(@RequestBody @Valid DatadictQueryForm form);


    /**
     * 字典列表查询（全字段信息）
     *
     * @param form form
     * @return response entity
     * @throws BusinessServiceException business service exception
     */
    @RequestMapping(value = "/s/datadict/queryList", method = RequestMethod.POST)
    public ResponseEntity<CentreListResponse<DatadictVo>> queryDatadictFullList(@RequestBody @Valid DatadictQueryForm form) throws BusinessServiceException;

    /**
     * 新增字典
     *
     * @param form form
     * @return response entity
     */
    @RequestMapping(value = "/s/datadict/addDatadict", method = RequestMethod.POST)
    public ResponseEntity<DatadictVo> addDatadict(@RequestBody @Valid DatadictCreateForm form);

    /**
     * 根据code查询字典
     *
     * @param dataDictCode data dict code
     * @return 从msg中获取 response entity
     */
    @RequestMapping(value = "/s/datadict/getDataDictValByCode", method = RequestMethod.POST)
    public ResponseEntity queryDatadictByCode(@RequestParam(value = "dataDictCode") String dataDictCode);

    /**
     * Gets data dict string by code *
     *
     * @param dataDictCode data dict code
     * @return the data dict string by code
     */
    @RequestMapping(value = "/s/datadict/getDataDictStringByCode", method = RequestMethod.POST)
    public String getDataDictStringByCode(@RequestParam(value = "dataDictCode") String dataDictCode);

    /**
     * 根据code查询字典
     *
     * @param dataDictTypeCode data dict type code
     * @return 从msg中获取 data dict val by type code
     */
    @RequestMapping(value = "/s/datadict/getDataDictValByTypeCode", method = RequestMethod.POST)
    public List<DatadictPo> getDataDictValByTypeCode(@RequestParam(value = "dataDictTypeCode") String dataDictTypeCode);

    /**
     * 更新互斥状态
     *
     * @param dataDictCode data dict code
     * @return response entity
     */
    @RequestMapping(value = "/s/datadict/updateMutexStatusByCode", method = RequestMethod.POST)
    public ResponseEntity updateMutexStatusByCode(@RequestParam(value = "dataDictCode") String dataDictCode);

    /**
     * 根据用户编码获取用户信息
     *
     * @param userCode user code
     * @return user vo
     * @throws BusinessServiceException business service exception
     */
    @PostMapping(value = "/s/user/api/queryUserByUserCode")
    UserVo queryUserByUserCode(@RequestParam(value = "userCode") String userCode) throws BusinessServiceException;


    /**
     * 根据用户codes查询批量组织
     *
     * @param userCodes user codes
     * @return list list
     */
    @PostMapping(value = "/s/user/queryUserByCode")
    List<UserForm> queryUserByCode(@RequestParam("userCodes") String userCodes);


    /**
     * Query user by user code list list
     *
     * @param userCodes user codes
     * @return the list
     */
    @PostMapping(value = "/s/user/queryUserByUserCodeList")
    List<UserForm> queryUserByUserCodeList(@RequestParam("userCodes") List<String> userCodes);

    /**
     * 根据组织IDList批量获取组织信息
     *
     * @param ids ids
     * @return list list
     */
    @PostMapping(value = "/s/org/queryOrgById")
    public List<OrgCreateForm> queryOrgById(@RequestParam(value = "ids") String ids);

    /**
     * 根据userCode查询工作组列表
     *
     * @param userCode user code
     * @return list list
     */
    @RequestMapping(value = "/s/group/queryGroupListByUserCode")
    public List<GroupVo> queryGroupListByUserCode(@RequestParam(value = "userCode") String userCode);

    /**
     * 查新组织管理员code
     *
     * @param userCode user code
     * @return string string
     */
    @RequestMapping(value = "/s/org/queryOrgAdminCode")
    String queryOrgAdminCode(@RequestParam(value = "userCode") String userCode);

    /**
     * 根据组织ID批量获取子树节点
     *
     * @param id id
     * @return response entity
     */
    @PostMapping(value = "/s/org/queryTreeChildren")
    public ResponseEntity<List<OrgTreeForm>> queryTreeChildren(@RequestParam(value = "id") Integer id);

    /**
     * 根据UserCode获取所有上级组织（包括本组织）
     *
     * @param userCode user code
     * @return list list
     */
    @PostMapping(value = "/s/org/queryParentOrgByUserCode")
    List<OrgCreateForm> queryParentOrgByUserCode(@RequestParam(value = "userCode") String userCode);


    /**
     * 查询单个组织下的人
     *
     * @param form form
     * @return response entity
     */
    @RequestMapping(value = "/s/user/queryUserByOrgId", method = RequestMethod.POST)
    public ResponseEntity<CentreCutPageResponse<UserPo>> queryUserByOrgId(@RequestBody OrgQueryForm form);

    /**
     * Query user form list
     *
     * @param form form
     * @return the list
     */
    @RequestMapping(value = "/s/user/queryUserForm", method = RequestMethod.POST)
    public List<UserPo> queryUserForm(@RequestBody FileSpaceSettingQueryForm form);

    /**
     * Query user form count int
     *
     * @param form form
     * @return the int
     */
    @RequestMapping(value = "/s/user/queryUserFormCount", method = RequestMethod.POST)
    public int queryUserFormCount(@RequestBody FileSpaceSettingQueryForm form);

    /**
     * 字典查询
     *
     * @param dataDictCode data dict code
     * @return dict val by code
     */
    @RequestMapping(value = "/s/datadict/getDictValByCode", method = RequestMethod.POST)
    public String getDictValByCode(@RequestParam(value = "dataDictCode") String dataDictCode);


    /**
     * 查询用户等级
     *
     * @return list list
     */
    @RequestMapping(value = "/s/userlevel/queryUserLevelList", method = RequestMethod.POST)
    List<UserLevelPo> queryUserLevelList();


    /**
     * 查询用户是否是特权用户
     *
     * @param userCode user code
     * @return response entity
     */
    @RequestMapping(value = "/s/user/queryIsTq", method = RequestMethod.POST)
    public ResponseEntity queryIsTq(@RequestParam(value = "userCode") String userCode);


    /**
     * Query email setting email settting vo
     *
     * @return the email settting vo
     */
    @RequestMapping(value = "/s/api/queryEmailSetting", method = RequestMethod.POST)
    EmailSetttingVo queryEmailSetting();

    /**
     * Gets msg template by code *
     *
     * @param code code
     * @return the msg template by code
     */
    @RequestMapping(value = "/s/api/getMsgTemplateByCode", method = RequestMethod.POST)
    MsgTemplateVo getMsgTemplateByCode(String code);

    /**
     * Query role code list list
     *
     * @param userCode user code
     * @return the list
     */
    @RequestMapping(value = "/s/api/queryRoleCodeList", method = RequestMethod.POST)
    public List<String> queryRoleCodeList(@RequestParam(value = "userCode") String userCode);
}